UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KKvzy6azj2OztAzUswsECVqTYsz8UeyuSlUQD0RQN1s=' 
WHERE 
  key_id = '67caf48a4c2e02de88545d263846120eaff961252771e5b63cdc06cdfbb43f67' 
  AND (
    token = 'KKvzy6azj2OztAzUswsECVqTYsz8UeyuSlUQD0RQN1s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038