UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YxJMeS6GZt+SrzZQo9jMXIZpEhD2HM1AaCoqJLIRj2c=' 
WHERE 
  key_id = '36db3274735090336399fdadfdaf684abc661a6ed547e2fd18013be2b9c27b9f' 
  AND (
    token = 'YxJMeS6GZt+SrzZQo9jMXIZpEhD2HM1AaCoqJLIRj2c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037