UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q1Bba89CxyEoPkdaLRCPkwaVF5g77VEbYBML0MwVmxQ=' 
WHERE 
  key_id = '4e082b7ae376a41a7eefdeb74d483cb57fb8d87c84488867360d70c4aa7a0358' 
  AND (
    token = 'q1Bba89CxyEoPkdaLRCPkwaVF5g77VEbYBML0MwVmxQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027