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

Query time 0.00045