UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dIWtQPXVHgfNmPfA4IhoAFrw8aX1Yww67NuTDbOGU+A=' 
WHERE 
  key_id = '63c9a126a48679404d87b2f738af2b10747f713c3fd23ab50b92b58f174a01f7' 
  AND (
    token = 'dIWtQPXVHgfNmPfA4IhoAFrw8aX1Yww67NuTDbOGU+A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029