UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hBlkXMAyJWSpDGtGjc5+4N0xbS0L62Lr5ywq74H/DxA=' 
WHERE 
  key_id = '019358a81f54a16f9d0ddf4d045e700b83d5c018a458e7c05277b0fe304a2cf1' 
  AND (
    token = 'hBlkXMAyJWSpDGtGjc5+4N0xbS0L62Lr5ywq74H/DxA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032