UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YTX6EjGUleHvP3/o++GSpK6Y+kQW3+Xq5Ifkm3Nr4qw=' 
WHERE 
  key_id = '66acdf306d753862b47e6e04119dabcb76eb1dc5a6ee50a2eba83e195fb7bed2' 
  AND (
    token = 'YTX6EjGUleHvP3/o++GSpK6Y+kQW3+Xq5Ifkm3Nr4qw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032