UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rp5PeKxYeAjYUP0Yt0sSr0NJhXKBXTUiA5Wp7lXX5cU=' 
WHERE 
  key_id = '909b8c5871f5e14f9425d1390304246ce79dab09a0fa071e0dc3d960e1e31270' 
  AND (
    token = 'rp5PeKxYeAjYUP0Yt0sSr0NJhXKBXTUiA5Wp7lXX5cU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021