UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BKsO+TsKC2fzUoiqvM/oXH1D+P7R/ghV5vOBezB6pgQ=' 
WHERE 
  key_id = 'e7bc3287a034465bc684295c502a9b50f9a268724b5746eb4ca4a064e0b48ab7' 
  AND (
    token = 'BKsO+TsKC2fzUoiqvM/oXH1D+P7R/ghV5vOBezB6pgQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024