UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CmRaenToZ2bGF9xUYBEB11L0IeM869RK5AeI+IG/Pso=' 
WHERE 
  key_id = 'd34b1b4c402ec3c558555ce3fcf80b093a4787d7d5bd3bed51bac6efaae81e4a' 
  AND (
    token = 'CmRaenToZ2bGF9xUYBEB11L0IeM869RK5AeI+IG/Pso=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026