UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8cgjw+ZCgf2rVzPzC/d7kTiQirnnBixILy4wphlcVAk=' 
WHERE 
  key_id = '247c60912958d8b5426317d5c21db20f580166648b92f983c36c558a84cfbbad' 
  AND (
    token = '8cgjw+ZCgf2rVzPzC/d7kTiQirnnBixILy4wphlcVAk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027