UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AXKOOqk1RRzBJ1RsWDQ189toohI3+lErddepakKVdo4=' 
WHERE 
  key_id = '48f2d5520be0f822083a85a94e4c7aff820b16db2af08ad4c50a7f644add5a81' 
  AND (
    token = 'AXKOOqk1RRzBJ1RsWDQ189toohI3+lErddepakKVdo4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032