UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0IftcJ+jeVWDJ1hivcZjngklqeODavuWIeU8fICGlyA=' 
WHERE 
  key_id = 'a04f9152b27e7cfbf0faf3378bb63251aad37652bef4745261dcc9e23dc5f390' 
  AND (
    token = '0IftcJ+jeVWDJ1hivcZjngklqeODavuWIeU8fICGlyA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025