UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QGH1WJkIEJOCtuWY14uk2Q1UPzpuyHE56WoKyT89E5c=' 
WHERE 
  key_id = '6e1770a8b926fdfd86e404f47ce81f168596461c82b30f7c58d7de00977d655c' 
  AND (
    token = 'QGH1WJkIEJOCtuWY14uk2Q1UPzpuyHE56WoKyT89E5c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023