UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SCmg4MDWw3eRTK47kR/SuSI0EfgE6f1NmunDg/P+yDY=' 
WHERE 
  key_id = '1ef83c938e7ec660718c864dfa4cad38f9494cf8ad219d21aa7f08ef5e525701' 
  AND (
    token = 'SCmg4MDWw3eRTK47kR/SuSI0EfgE6f1NmunDg/P+yDY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036