UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uwulwocdhAFMUM8p0JyGdQB3T4bjo6vTBIdPEFF9OLU=' 
WHERE 
  key_id = 'd51db5f7dfdeca5677bae43f2aa8c41456d6ccf1daacddc77219e2d131b64319' 
  AND (
    token = 'uwulwocdhAFMUM8p0JyGdQB3T4bjo6vTBIdPEFF9OLU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029