UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SPrErY/WZbz27BNBmsVTXaWy8TjvpOPi8w+ZWTU2kOM=' 
WHERE 
  key_id = '79da9bd6878a1716d15273c99416d6e82171174fe99eb1dc556dd92fdb13f793' 
  AND (
    token = 'SPrErY/WZbz27BNBmsVTXaWy8TjvpOPi8w+ZWTU2kOM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032