UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Hgj35r9ukQO518oh+sx/qPDjEuHC5XOUOpaCUwCnL+M=' 
WHERE 
  key_id = '0e161319c650669a078980e24ab5a3d813a700ea4056d1646e86f4c227965f0d' 
  AND (
    token = 'Hgj35r9ukQO518oh+sx/qPDjEuHC5XOUOpaCUwCnL+M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033