UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g+DQXWHlQgnI/vjTSt0G0AkL4CKh5VN4sJo+HeqANzc=' 
WHERE 
  key_id = '95f51d30ff1fb26f16eb30409d2b7f2beeaf5786692954b23d5833d4de5b9d05' 
  AND (
    token = 'g+DQXWHlQgnI/vjTSt0G0AkL4CKh5VN4sJo+HeqANzc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028