UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aEIUxHeYer24EHNsLzJMnXtmeu0FmJsi/XfHPhNiPoU=' 
WHERE 
  key_id = '9189279bb9bd9393b972d303db7b8bbe51b7bcb42614bbec845a9d463826af59' 
  AND (
    token = 'aEIUxHeYer24EHNsLzJMnXtmeu0FmJsi/XfHPhNiPoU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028