UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AZkelvxfrdj2wcF5UUwf6nIepr5umFggMcpNik2JjpM=' 
WHERE 
  key_id = 'b64c049a94b2d12da969e95dc821c8f65218430caaaf526a1dc9a2b93ffdbeb5' 
  AND (
    token = 'AZkelvxfrdj2wcF5UUwf6nIepr5umFggMcpNik2JjpM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036