UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o0msuDHLCWVqAnu/k+HqNMa63xanhQ90e/XExQDK2wM=' 
WHERE 
  key_id = 'e2658a962f24611681cf408d09831e9134f7c793ed02674f2867b9957440a3cf' 
  AND (
    token = 'o0msuDHLCWVqAnu/k+HqNMa63xanhQ90e/XExQDK2wM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034