UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5ugRKeSJVEjxT1H9hGJnYfbGeVjVfg3tJHW9ZhszUe4=' 
WHERE 
  key_id = '669b76ccc2d34747d25e8181ac65708fc4f37a59df8ec475b515ffa411ff225f' 
  AND (
    token = '5ugRKeSJVEjxT1H9hGJnYfbGeVjVfg3tJHW9ZhszUe4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030