UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cAFeTU9Wqbecs0Ze2IlAHuwLGhrtuNDP2BNDZW0mHjs=' 
WHERE 
  key_id = '9945510f94045d04b7b0dacfa8c40b8766e9795b0d114c732589820af9250d1f' 
  AND (
    token = 'cAFeTU9Wqbecs0Ze2IlAHuwLGhrtuNDP2BNDZW0mHjs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042