UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wEm4biI60+wNA/IHRGtHVAEe8BcLUfwlZsY/Ec+Z6BE=' 
WHERE 
  key_id = 'a29db3611d997928d60c22af9b885049bce936cfd885905f0594ead442decfb4' 
  AND (
    token = 'wEm4biI60+wNA/IHRGtHVAEe8BcLUfwlZsY/Ec+Z6BE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031