UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WD7BdT3A15Xv57XLbdmu+Ki+/GtFYiIfWczbJHflz+o=' 
WHERE 
  key_id = '7bc1504142f40f466c14d25a237dedad57275c5e2134eed5149cd87cce02d2e5' 
  AND (
    token = 'WD7BdT3A15Xv57XLbdmu+Ki+/GtFYiIfWczbJHflz+o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051