UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V2zbECYssFrAyxYlnNsohaYHPj6N33+9UKl9mbIsghE=' 
WHERE 
  key_id = 'e6e3b6ebf57bef3ae804baebbf3674bddaf3747c22ca9e92b03756a9a90159cb' 
  AND (
    token = 'V2zbECYssFrAyxYlnNsohaYHPj6N33+9UKl9mbIsghE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00092