UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QxEBCAzorbhOvDptYQFV8LL53BxyU34uogtfhq6XiRE=' 
WHERE 
  key_id = 'e59330ba63018a8f5379c6852f5ed1a85842ab1850a7312a07c767ac8407749d' 
  AND (
    token = 'QxEBCAzorbhOvDptYQFV8LL53BxyU34uogtfhq6XiRE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049