UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EzbzNsZ9LX1ksEGu0//iTW/TKCi8eTBO0NvTKCzfuYg=' 
WHERE 
  key_id = '549d7bb2cd07338e1648720817e4e5f9eefa272ee0da65de9f6b71c530f6f530' 
  AND (
    token = 'EzbzNsZ9LX1ksEGu0//iTW/TKCi8eTBO0NvTKCzfuYg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040