UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uKr9yNW+wmIAaluKDzPadQui1nXVERrP9W7kTNaWW6E=' 
WHERE 
  key_id = '4f17154dde5ccce103d602fabdaba995067e068b0e716569d2e15a8aaff58ac8' 
  AND (
    token = 'uKr9yNW+wmIAaluKDzPadQui1nXVERrP9W7kTNaWW6E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022