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

Query time 0.00035