UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'llYlkp7RmRKynHjw2RzYjbQuULtH+AP9p86QOrZf+ZE=' 
WHERE 
  key_id = '6ed14f04b40303e79a904c112964105fba95eeca41255502bc92f1b6337b0aca' 
  AND (
    token = 'llYlkp7RmRKynHjw2RzYjbQuULtH+AP9p86QOrZf+ZE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020