UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LHBEzXe2qDHZHHIdlL+yloEK+94S8yis27s1dfSdDw4=' 
WHERE 
  key_id = '47c33ed9fd5896a2160c9fa98fbb3e3364939d0efe585693859db112babd9762' 
  AND (
    token = 'LHBEzXe2qDHZHHIdlL+yloEK+94S8yis27s1dfSdDw4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044