UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AGn7n4MPM4LAUduc+XFUERH/VSMS1CUL6EW2mYE/Z1Y=' 
WHERE 
  key_id = '4a38e6bba4459a4882684859a6774fcc0d0aa4ddfa75217b9b9137c8df6c07b5' 
  AND (
    token = 'AGn7n4MPM4LAUduc+XFUERH/VSMS1CUL6EW2mYE/Z1Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039