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

Query time 0.00062