UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WKUhvtRTYAPIKViL8nbmwbeaz5Hu9lkQTqt1xHLL8HA=' 
WHERE 
  key_id = '42fc239fbad24496e7b709064f369631935f5d5207262661092f544c6c99224a' 
  AND (
    token = 'WKUhvtRTYAPIKViL8nbmwbeaz5Hu9lkQTqt1xHLL8HA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024