UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0RV0V3+nc94mTItGH2aGGHuFdeWOt97l8V6Mb+1l4Sw=' 
WHERE 
  key_id = 'a21a49dead07396f8d52f52c08090f580d6ec636424d737d42eea10e9c5c2707' 
  AND (
    token = '0RV0V3+nc94mTItGH2aGGHuFdeWOt97l8V6Mb+1l4Sw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021