UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FZlFkzvgSj2e0Rk6DnHfJgWB1AOUyc+GHPiamoPCVlM=' 
WHERE 
  key_id = '9150269deaa8518dc9a693aaf358c1f7b99940d92467bbc48f7e2b11d6738066' 
  AND (
    token = 'FZlFkzvgSj2e0Rk6DnHfJgWB1AOUyc+GHPiamoPCVlM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057