UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oTNibjXK9g3sGvkH3mSoNMOqApaeHLbEmW8JIyY47js=' 
WHERE 
  key_id = '81313c9618ce9188773439205b3f3349bd8d7907a1daa293c797cf2d746b0a3f' 
  AND (
    token = 'oTNibjXK9g3sGvkH3mSoNMOqApaeHLbEmW8JIyY47js=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038