UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kDNf4R1zK0kQ24fB7XBgzgUpjeY3rZUY4sqfUJ3IEOQ=' 
WHERE 
  key_id = '0c96a161c65ccc533cc8244fb41f98750ba167e8a285721f9c87ea67bfad8375' 
  AND (
    token = 'kDNf4R1zK0kQ24fB7XBgzgUpjeY3rZUY4sqfUJ3IEOQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048