UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'duhGylqZq7M68fX8P2Zc61Y4FwSkWnGrrIC7XE7GXlM=' 
WHERE 
  key_id = '32c31bfb584154c0b081192d66c3e19eca7508338801dc1d48d19eeabfc7e761' 
  AND (
    token = 'duhGylqZq7M68fX8P2Zc61Y4FwSkWnGrrIC7XE7GXlM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036